﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using JM.JCY.BusinessEntity;

namespace JM.JCY.DataAccess
{
    public class EventDA : JCYDataAccessBasecs
    {
        public void UpdateEvent(EventDataset.T_EventDataTable dt)
        {
            base.Helper.Update(dt);
        }

        public void UpdateEventReceiver(EventDataset.T_Event_ReceiverDataTable dt)
        {
            base.Helper.Update(dt);
        }

        public EventDataset.T_Event_S_ByReceiverDataTable GetEventByReceiver(string subject, int receiverId, DateTime? startDate, DateTime? endDate, string status)
        {
            var dt = new EventDataset.T_Event_S_ByReceiverDataTable();
            base.Helper.Fill(dt, "P_Event_S_ByReceiver", subject, receiverId, startDate, endDate, status);
            return dt;
        }

        public EventDataset.T_Event_S_BySenderDataTable GetEventBySender(string subject, int senderId, DateTime? startDate, DateTime? endDate, string status)
        {
            var dt = new EventDataset.T_Event_S_BySenderDataTable();
            base.Helper.Fill(dt, "P_Event_S_BySender", subject, senderId, startDate, endDate, status);
            return dt;
        }

        public EventDataset.T_EventDataTable GetEventDetailById(int eventId)
        {
            var dt = new EventDataset.T_EventDataTable();
            base.Helper.Fill(dt, "P_GetEventById", eventId);
            return dt;
        }

        public EventDataset.T_Event_ReceiverDataTable GetEventReceiverById(int eventId)
        {
            var dt = new EventDataset.T_Event_ReceiverDataTable();
            base.Helper.Fill(dt, "P_Event_Receiver_S_View", eventId);
            return dt;
        }

        public EventDataset.T_Event_ReceiverDataTable GetEventReceiverByReceiverId(int receiverId)
        {
            var dt = new EventDataset.T_Event_ReceiverDataTable();
            base.Helper.Fill(dt, "P_Event_Receiver_S_ById", receiverId);
            return dt;
        }

        public EventDataset.T_EventDataTable GetEventForHome(int count, int receiverId)
        {
            var dt = new EventDataset.T_EventDataTable();
            base.Helper.Fill(dt, "P_Event_S_forHome", count, receiverId);
            return dt;
        }

        public EventDataset.T_EventDataTable GetMyEvent(string userName, string status,string type)
        {
            var dt = new EventDataset.T_EventDataTable();
            base.Helper.Fill(dt, "P_GetMyEvent",userName,status,type);
            return dt;
        }
    }
}
